const cloud = require('wx-server-sdk')

let db = cloud.database()

exports.main = async (event,context)=>{
	let infos = event.userInfo;
  delete infos['_id']
  console.log(infos.username);
  let ff = db.collection('user_info').where({
    openid:infos.openid
  });
  let result = await ff.update({
    data:infos
  })
  console.log(result);
	return {'msg':'ok','data':result}
}